package com.zx.map.utils;

import com.zx.platform.utils.StrUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by bibei on 2017/2/13.
 * 通用工具类
 */
public class CommonUtils {
	//判断是否全是数字
	public static boolean isNumer(String number) {
		if (StrUtils.isEmpty(number)) {
			return false;
		}
		Pattern pattern = Pattern.compile("[0-9]*");
		Matcher isNum = pattern.matcher(number);
		return isNum.matches();
	}
	/**判断字符类型是否是号码或字母
	 * @param str
	 * @return
	 */
	public static boolean isNumberOrAlpha(String str) {
		if (StrUtils.isEmpty(str,false)) {
			return false;
		}
		Pattern p = Pattern.compile("^[A-Za-z0-9]+$");
		Matcher m = p.matcher(str);
		return m.matches();
	}
}
